<%-- 
    Document   : supplementaries
    Created on : Nov 8, 2009, 1:39:21 AM
    Author     : moustafa
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.Iterator" %>
<%@page import="model.Inventory" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
            ArrayList<Inventory> deffInvs = (ArrayList<Inventory>)request.getSession(false).getAttribute("defficiencies");
            ArrayList<Inventory> suppInvs = (ArrayList<Inventory>)request.getSession(false).getAttribute("supplementaries");
            int deffIndex = (Integer)(request.getSession(false).getAttribute("deff_index"));
            Inventory deffInv = deffInvs.get(deffIndex);
            
        %>

        <table border="1" cellspacing="1" cellpadding="1">
            <thead>
                <tr>
                    <th><%=deffInv.getWarehouse().getName()%></th>
                    <th><%=deffInv.getProduct().getName()%></th>
                    <th><%=deffInv.getQuantity() %></th>
                </tr>
            </thead>
        </table>
        <br>
        <hr>
        <p align="center">Supplementary Inventories</p>
        <table border="1" cellspacing="1" cellpadding="1">
            <thead>
                <tr>
                    <th>Warehouse</th>
                    <th>Product</th>
                    <th>Quantity</th>
                    <th>Recover</th>
                </tr>
            </thead>
            <tbody>
                <%
                Iterator<Inventory> suppsItr = suppInvs.iterator();
                int suppIndex = 0;
                while(suppsItr.hasNext()){
                    Inventory suppInv = suppsItr.next();
                     %>

                     <%=
                     "<tr>"+
                        "<td>" + suppInv.getWarehouse().getName() + "</td>"+
                        "<td>" + suppInv.getProduct().getName() + "</td>"+
                        "<td>" + suppInv.getQuantity() + "</td>"+
                        "<td align='center'>" +
                        "<form action='../admin/recoverinv' method='POST'>" +
                            "<input type='hidden' name='supp_index' value='" + suppIndex + "'/>" +
                        "<input type='submit' value='Recover'/>" +
                        "</form>" +
                        "</td>"+
                     "</tr>"
                     %>
                     <%
                     suppIndex++;
                 }
                 %>
            </tbody>
        </table>
    </body>
</html>
